<%@ include file="/common/taglibs.jsp"%>
<link href="<c:url value='/css/tablesorter.css' />" rel="stylesheet" type="text/css"/>
<link href="<c:url value='/css/dhtmlxcombo_view.css' />" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
	$(document).ready(function() {
		$('#pageTitle').text('<spring:message code="donorlist.heading" />');
		
		$('.tablesorter').tablesorter({
			widgets : [ 'zebra' ]
		});

		$('.edit-donor-link').click(function() {
			loadDiv('content', 'showEditDonor.do?id=' + $(this).attr('donorId'));
		});
	});
	$('.close-button').click(function() {
		window.location = '../secure/showDashboard.do';
		//if(confirm('Are you sure that you want to close the form?')) {
			//window.location = '../secure/showDashboard.do';
		//}	
	});
</script>
<div id="donorListDiv" class="hastable" style="overflow: auto">
  <security:authorize ifAnyGranted="ROLE_ADMIN,ROLE_GRANTS,ROLE_STAFF,ROLE_KM,ROLE_SENIOR_MANAGEMENT">
    <c:set var="canViewDonor" value="true" />
  </security:authorize>
	<div class="main_form">
		<div class="form_head">
	    		<a href="#" class="close-button gray_btn floatR">Close Form</a>
	    		<br class="clear" />
	    </div>
	    <div class="form_cont">
		<table class="tablesorter">
			<thead>
				<tr>
					<th><spring:message code="donorlist.table.heading.name" /></th>
					<th><spring:message code="donorlist.table.heading.acronym" /></th>
					<th><spring:message code="donorlist.table.heading.url" /></th>
					<th><spring:message code="donorlist.table.heading.contactName" /></th>
					<th><spring:message code="donorlist.table.heading.email" /></th>
					<th><spring:message code="donorlist.table.heading.city" /></th>
					<th><spring:message code="donorlist.table.heading.state" /></th>
					<th><spring:message code="donorlist.table.heading.country" /></th>
					<!-- 
					<th><spring:message code="donorlist.table.heading.address1" /></th>
					<th><spring:message code="donorlist.table.heading.zipCode" /></th>
					<th><spring:message code="donorlist.table.heading.phone" /></th>
					<th><spring:message code="donorlist.table.heading.fax" /></th>
					-->
					<%-- <th><spring:message code="donorlist.table.heading.viewAward" /></th>
					<th><spring:message code="donorlist.table.heading.edit" /></th> --%>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${donors}" var="donor">
					<tr>
						<td>
                          <c:choose>
                            <c:when test="${!empty canViewDonor && canViewDonor}">
                              <a href="javascript://" class="edit-donor-link" donorId="${donor.id}">${donor.donorName}</a>
                            </c:when>
                            <c:otherwise>
                              ${donor.donorName}
                            </c:otherwise>
                          </c:choose>
                        </td>
						<td>${donor.donorAcronym}</td>
						<td><a href="${donor.url}" target="_blank">${donor.url}</a></td>
						<td>${donor.contactName}</td>
						<td>${donor.email}</td>
						<td>${donor.city}</td>
						<td>${donor.state.displayName}</td>
						<td>${donor.country.displayName}</td>
						<!-- 
						<td>${donor.address1}</td>
						<td>${donor.zipCode}</td>
						<td>${donor.phone}</td>
						<td>${donor.fax}</td>
						<%-- <td><a href="javascript://" class="view-awards-link" donorId="${donor.id}"><spring:message code="donorlist.table.link.viewAward" /></a></td> --%>
						<td><a href="javascript://" class="edit-donor-link" donorId="${donor.id}"><spring:message code="donorlist.table.link.edit" /></a></td>
						 -->
					</tr>
				</c:forEach>
			</tbody>
		</table>
		<div id="donorListPager"></div>
	</div>
	</div>
</div>
